package com.codechen.scaffold.admin.controller;

import com.codechen.scaffold.admin.domain.request.RegisterUserRequest;
import com.codechen.scaffold.admin.service.IRegisterService;
import com.codechen.scaffold.common.domain.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author：wuweihong
 * @date：2024/5/24 17:16
 * @description：登录
 */
@RestController
@RequestMapping("/register")
@Api(tags = "用户注册")
public class RegisterController {

    @Autowired
    private IRegisterService registerService;

    @ApiOperation(value = "用户注册")
    @PostMapping("/")
    public Result register(@Validated @RequestBody RegisterUserRequest registerUserRequest) {
        Long userId = registerService.registerUser(registerUserRequest);
        return Result.success(userId);
    }

}
